package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 文件复制：将一个文件中的数据放到另一个文件中
 */
public class CopyDemo {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("guilin.jpg");
        FileOutputStream fos = new FileOutputStream("guilin_cp.jpg");

        long start = System.currentTimeMillis();
        int b;
        while ((b= fis.read())!=-1){
            fos.write(b);
        }
        System.out.println("复制完成");
        long end = System.currentTimeMillis();
        System.out.println("耗时:"+(end-start));

        fis.close();
        fos.close();
    }
}
